package com.aplink.generic.widgets;

import android.view.View;
import android.widget.ImageView;

import com.aplink.generic.GenericFragment;
import com.aplink.generic.pojo.GenericAttribute;
import com.aplink.generic.pojo.controlspec.ControlSpec;
import com.aplink.generic.util.FetchBitmapAysn;

public class CustomImageView extends BaseView {
    private ImageView mImageView;

    public CustomImageView( GenericFragment genericFragment,
                            ControlSpec controlSpec, View view ) {
        super( genericFragment, controlSpec, view );
        mImageView = (ImageView) view;
    }

    @Override
    protected void loadDataToView() {
        // TODO Auto-generated method stub

    }

    @Override
    protected void doIfNotHashPassedValues() {
        // TODO Auto-generated method stub

    }

    @Override
    protected void setEventListener() {

    }

    @Override
    protected void initViewProperties() {
        boolean isVisibility = getControlSpec().isVisibility();
        if ( ! isVisibility ) {
            mImageView.setVisibility( View.INVISIBLE );
        }
        String mappingName = getControlSpec().getMappingName();
        String imageUrl = getPassedGenericObject().getContentFromAttributeName(
                mappingName );
        new FetchBitmapAysn( mImageView, false, 1400, 1200, null )
                .execute( imageUrl );
    }

    @Override
    public GenericAttribute<?, ?> getAttribute() {
        // TODO Auto-generated method stub
        return null;
    }

}
